$('.table-sort').dataTable({
    searching:false,
    ordering:false
});

var setting = {
    view: {
        dblClickExpand: false,
        showLine: true,
        selectedMulti: false
    },
    data: {
        simpleData: {
            enable:true,
            idKey: "id",
            pIdKey: "pId",
            rootPId: ""
        }
    }
};

var zuzhiNodes = [
    { id:1, pId:0, name:"所有部门", open:true},
    { id:101, pId:1, name:"部门1", open:true},
    { id:10101, pId:101, name:"子部门1"},
    { id:10102, pId:101, name:"子部门2"},
    { id:10103, pId:101, name:"子部门3"},
    { id:102, pId:1, name:"部门2", open:true},
    { id:10201, pId:102, name:"子部门1"},
    { id:10202, pId:102, name:"子部门2"},
    { id:10203, pId:102, name:"子部门3"},
    { id:103, pId:1, name:"部门3", open:true},
    { id:10301, pId:103, name:"子部门1"},
    { id:10302, pId:103, name:"子部门2"},
    { id:10303, pId:103, name:"子部门3"},
];

$(document).ready(function(){
    var t1 = $("#zuzhiTree");
    t1 = $.fn.zTree.init(t1, setting, zuzhiNodes);


});

//更多查询条件  按钮 单击事件
$('#openMoreBtn').on('click',function(){
    //控制 收起图标 隐藏显示
    $('#shouqiImg')[0].classList.toggle('app-hidden');
    //控制 更多图标隐藏显示
    $('#gengduoImg')[0].classList.toggle('app-hidden');
    //控制 更多查询框 隐藏显示
    $('#otherQueryList')[0].classList.toggle('app-hidden');

});

//新增按钮单击事件
$('#addBumenBtn').on('click',function(){
    layer.open({
        type: 2,
        title: '添加部门',
        shadeClose: true,
        shade: 0.5,
        area: ['80%', '33%'],
        content: 'riZhiZhuiSu_AddBuMen.html' //iframe的url
    });
});

//表格中的删除按钮 事件绑定
$('.app-delete').on('click',function(){

    var that = this;

    layer.confirm('确定删除选中的数据？', {
        btn: ['确定','取消'] //按钮
    }, function(){
        var tr = that.parentNode.parentNode;
        tr.parentNode.removeChild(tr)
        layer.msg('删除成功', {icon: 1});
    }, function(){

    });
});